package com.boboPlanet.config;

import com.boboPlanet.filter.GrayLoadBalancerFilter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cloud.gateway.config.LoadBalancerProperties;
import org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
 * @Description: TODO 网关灰度负载均衡配置
 * @Author: mis_wu
 * @Date: 2023/5/13
 * @Company planet
 **/
@Configuration
public class GrayGatewayReactiveLoadBalancerAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean({GrayLoadBalancerFilter.class})
    public GrayLoadBalancerFilter grayReactiveLoadBalancerClientFilter(LoadBalancerClientFactory clientFactory, LoadBalancerProperties properties) {
        return new GrayLoadBalancerFilter(clientFactory, properties);
    }

}
